import { createApp } from "vue";
import App from "./App.vue";
import router from "./router";
import { setupDirectives } from './directives/index'
import { setupRouter } from './router/index'
import { setupStore } from './store/index'
import { setupComponent } from './components/index'

async function initApp() {
  const app = createApp(App);

  // 注册全局公共组件
  setupComponent(app);

  // 注册全局自定义指令
  setupDirectives(app);

  // 挂载状态管理
  setupStore(app);

  // 挂载路由
  await setupRouter(app);

  // 路由准备就绪后挂载APP实例
  await router.isReady();

  app.mount("#app");
}

initApp()